#ifndef _OCPP_Response_H__
#define _OCPP_Response_H__

#include "Request.h"

namespace OCPP
{
	class _MainExport Response
	{
		/// Pointer to the request that this response is in relation to
		const Request* mRequest;
		/// Whether the work item succeeded or not
		bool mSuccess;
		/// Any diagnostic messages
		String mMessages;
		/// Data associated with the result of the process
		Any mData;

	public:
		Response(const Request* rq, bool success, const Any& data, const String& msg = "");
		~Response();
		/// Get the request that this is a response to (NB destruction destroys this)
		const Request* getRequest() const { return mRequest; }
		/// Return whether this is a successful response
		bool succeeded() const { return mSuccess; }
		/// Get any diagnostic messages about the process
		const String& getMessages() const { return mMessages; }
		/// Return the response data (user defined, only valid on success)
		const Any& getData() const { return mData; }
		/// Abort the request
		void abortRequest() { mRequest->abortRequest(); mData.destroy(); }
	};
}

#endif
